<!-- 登录组件 -->
<template>
	<view>
		<tn-popup v-model="show" mode="bottom" height="460rpx" borderRadius="24">
			<view style="width: 100%; height: 100%;">
				<view style="height: 40px;"></view>
				<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
				  <image class="avatar" :src="avatarUrl"></image>
				</button> 
				<tn-form>
					<tn-form-item label="昵称:" :labelWidth="310" labelAlign="center">
						<input type="nickname" placeholder="请输入昵称"/>
					</tn-form-item>
				</tn-form>
				<!-- <tn-button shape="round" backgroundColor="tn-bk-pink">登 录</tn-button> -->
				<button class="login-button">登  录</button>
			</view>
		</tn-popup>
		<tn-button @click="show = true" style="margin: 0 auto;">打开</tn-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				value: "",
				avatarUrl: "https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0"
			}
		},
		methods: {
			onChooseAvatar(e) {
				const { avatarUrl } = e.detail 
				this.avatarUrl = avatarUrl
			}
		}
	}
</script>

<style lang="scss" scoped>
	.avatar-wrapper {
	  padding: 0;
	  width: 56px !important;
	  border-radius: 8px;
	}

	.avatar {
	  display: block;
	  width: 56px;
	  height: 56px;
	}

	.container {
	  display: flex;
	}
	
	.login-button {
		width: 500rpx;
		border-radius: 30px;
		color: white;
		background-color: #ff7d9e;
		position: absolute;
		bottom: 30rpx;
		left: 50%;
		transform: translateX(-50%);
	}
	
</style>